﻿using D20.Entities.Characters;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace D20.UnitTests.Characters
{
    
    
    /// <summary>
    ///This is a test class for AlignmentTest and is intended
    ///to contain all AlignmentTest Unit Tests
    ///</summary>
    [TestClass()]
    public class AlignmentTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Lawful
        ///</summary>
        [TestMethod()]
        public void LawfulTestPositiveMax()
        {
            Alignment target = new Alignment();
            float expected = Alignment.MaxAlignment; 
            float actual;
            target.Lawful = expected;
            actual = target.Lawful;
            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        ///A test for Lawful
        ///</summary>
        [TestMethod()]
        public void LawfulTestNegativeMax()
        {
            Alignment target = new Alignment();
            float expected = -Alignment.MaxAlignment;
            float actual;
            target.Lawful = expected;
            actual = target.Lawful;
            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        ///A test for Lawful
        ///</summary>
        [TestMethod()]
        public void LawfulTestIllegalPositive()
        {
            Alignment target = new Alignment();
            float expected = Alignment.MaxAlignment + 1;
            try
            {
                target.Lawful = expected;
            }
            catch (ArgumentOutOfRangeException)
            {
                return;
            }
        }
        /// <summary>
        ///A test for Lawful
        ///</summary>
        [TestMethod()]
        public void LawfulTestIllegalNegative()
        {
            Alignment target = new Alignment();
            float expected = -Alignment.MaxAlignment -1;
            try
            {
                target.Lawful = expected;
            }
            catch (ArgumentOutOfRangeException)
            {
                return;
            }
        }
        /// <summary>
        ///A test for Good
        ///</summary>
        [TestMethod()]
        public void GoodTestPositiveMax()
        {
            Alignment target = new Alignment();
            float expected = Alignment.MaxAlignment;
            float actual;
            target.Good = expected;
            actual = target.Good;
            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        ///A test for Good
        ///</summary>
        [TestMethod()]
        public void GoodTestNegativeMax()
        {
            Alignment target = new Alignment();
            float expected = -Alignment.MaxAlignment;
            float actual;
            target.Good = expected;
            actual = target.Good;
            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        ///A test for Good
        ///</summary>
        [TestMethod()]
        public void GoodTestIllegalPositive()
        {
            Alignment target = new Alignment();
            float expected = Alignment.MaxAlignment + 1;
            try
            {
                target.Good = expected;
            }
            catch (ArgumentOutOfRangeException)
            {
                return;
            }
        }
        /// <summary>
        ///A test for Good
        ///</summary>
        [TestMethod()]
        public void GoodTestIllegalNegative()
        {
            Alignment target = new Alignment();
            float expected = -Alignment.MaxAlignment - 1;
            try
            {
                target.Good = expected;
            }
            catch (ArgumentOutOfRangeException)
            {
                return;
            }
        }

        /// <summary>
        ///A test for Alignment Constructor
        ///</summary>
        [TestMethod()]
        public void AlignmentConstructorTest()
        {
            Alignment target = new Alignment(Alignment.MaxAlignment, -Alignment.MaxAlignment);
            Assert.AreEqual(Alignment.MaxAlignment, target.Lawful);
            Assert.AreEqual(-Alignment.MaxAlignment, target.Good);
        }

        /// <summary>
        ///A test for Equals
        ///</summary>
        [TestMethod()]
        public void EqualsTest()
        {
            Alignment target = new Alignment();
            object obj = new Alignment();
            bool expected = true;
            bool actual;
            actual = target.Equals(obj);
            Assert.AreEqual(expected, actual);

            obj = null;
            expected = false;
            actual = target.Equals(obj);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for op_Inequality
        ///</summary>
        [TestMethod()]
        public void op_InequalityTest()
        {
            Alignment left = new Alignment(1,-1); 
            Alignment right = new Alignment(1,2);
            bool expected = true; 
            bool actual;
            actual = (left != right);
            Assert.AreEqual(expected, actual);

            right = null;
            expected = true;
            actual = (left != right);
            Assert.AreEqual(expected, actual);
            
        }

        /// <summary>
        ///A test for op_Equality
        ///</summary>
        [TestMethod()]
        public void op_EqualityTest()
        {
            Alignment left = new Alignment(1, -1);
            Alignment right = new Alignment(1, 2);
            bool expected = false;
            bool actual;
            actual = (left == right);
            Assert.AreEqual(expected, actual);

            right = null;
            expected = false;
            actual = (left == right);
            Assert.AreEqual(expected, actual);
            right = new Alignment(1,-1);
            expected = true;
            actual = (left == right);
            Assert.AreEqual(expected, actual);
        }
    }
}
